{extend name="_container/add"}

{block name="content"}
{if $r.id}
<input type="hidden" name="id" value="{$r.id}">
{/if}
<div class="layui-form-item">
    <label class="layui-form-label required">中文名<span></span></label>
    <div class="layui-input-inline">
        <input type="text" placeholder="" name="comment" id="info_comment" class="layui-input modelform_comment"
               lay-verify="required" value="{$r?$r['comment']:''}" style="" autocomplete="off">
        <div class="description"></div>
    </div>
    <div class="layui-form-mid layui-word-aux"></div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label required">英文名<span></span></label>
    <div class="layui-input-inline">
        <input type="text" placeholder="" name="name" id="info_name" class="layui-input modelform_name"
               lay-verify="required" value="{$r?$r['name']:''}" style="" autocomplete="off">
        <div class="description"></div>
    </div>
    <div class="layui-form-mid layui-word-aux"></div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label ">排序<span></span></label>
    <div class="layui-input-inline">
        <input type="text" placeholder="" name="sort" id="field_length" class="layui-input modelform_name"
               value="{$r?$r['sort']:'10'}" style="" autocomplete="off">
        <div class="description"></div>
    </div>
    <div class="layui-form-mid layui-word-aux"></div>
</div>


{/block}
{block name="js"}
<script>
    function save_form3(obj) {
        save_form2(obj);
        return false;
    }
</script>


<script>
    let pre = "{:env('database.prefix')}";
    $('#info_comment').blur(
        function (obj) {
            let word = obj.target.value;
            if (word) {
                $.get('/auto/util/getEnglishWithType?word=' + word, (data) => {
                    let res = data.result.res;
                    if($('#info_name').val() == '' ){
                        $('#info_name').val(res);
                    }
                })
            }
        }
    )
</script>

{/block}

{/extend}
